﻿<?xml version="1.0" encoding="utf-8" ?>
<DbDataRequest name="GetCompanyDeepSearchResult" connection="$DBConnection$" type="ForumDBType" defaultFormatter="bizobj Company">
	<SqlStatement hasResults="true">
		SELECT  t.objectId as id,t.parentId,t.parentHostId,c.name,tc.keyName,tc.depth
		FROM ObjectTreeNodes  t 
			INNER JOIN ObjectTreeCounts as tc on tc.objectId = t.objectId
			INNER JOIN Companies c ON c.id=t.objectId
			
		WHERE t.parentHostId IN (SELECT id from companies where name $criteria$)
		ORDER BY tc.keyName
	</SqlStatement>
</DbDataRequest>
